package com.smart.parking.controller.backstage;

import java.util.Arrays;
import java.util.Map;

import com.smart.parking.config.Result;
import com.smart.parking.entity.NoticeEntity;
import com.smart.parking.service.NoticeService;
import com.smart.parking.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 公告信息表
 *
 * @author ciyun
 */
@RestController
@RequestMapping("/notice")
public class NoticeController {
    @Autowired
    private NoticeService noticeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Result list(@RequestParam Map<String, Object> params) {
        PageUtils page = noticeService.queryPage(params);

        return Result.ok().put("page", page);
    }

    /**
     * 删除公告
     *
     * @param noticeId 公告id
     * @return {@link Result}
     */
    @DeleteMapping("deleteNotice/")
    public Result deleteNotice(@RequestParam("noticeId") Long noticeId) {
        noticeService.deleteNotice(noticeId);
        return Result.ok();
    }

}
